package Testking14;

import java.util.ArrayList;
import java.util.Collections;

public class MyInt implements Comparable{

	public static void main(String[] args) {
		ArrayList<MyInt> list = new ArrayList<MyInt>();
		list.add(new MyInt(2));
		list.add(new MyInt(1));
		Collections.sort(list);
		System.out.println(list);
	}

	private int i;

	public MyInt(int i) {
		super();
		this.i = i;
	}

	@Override
	public String toString() {
		return Integer.toString(i);
	}

	@Override
	public int compareTo(Object o) {
		MyInt i2 = (MyInt) o;
		return i - i2.i;
	}


}
